BigDFT.Interop.DFTBInterop module

This module contains some wrappers for using DFTB+ to perform calculations.

https://dftbplus.org/

Input files are defined using: https://github.com/dftbplus/hsd-python

Parameters can be found at: https://dftb.org/parameters

class DFTBLogfile(sys, logname)[source]

This class stores the values of the result.tag generated by DFTB+.

sys

a handle to the original system used in the calculation.

Type:

BigDFT.Systems.System

energy

the energy of the system

Type:

float

property energy

The total energy of the system.

class DFTBCalculator(omp='1', mpi_run='', dry_run=False, skip=False, verbose=True)[source]

A calculator that drives DFTB+ calculations through the command line.

os = <module 'os' from '/usr/local/anaconda/lib/python3.7/os.py'>
pre_processing()[source]

Process local run dictionary to create the input directory and identify the command to be passed

Returns:

dictionary containing the command to be passed to process_run()

Return type:

dict

process_run(command)[source]

Run the DFTB+ executable.

post_processing(logname, command)[source]

Post processing the calculation.

Returns:

a representation of the detailed output.

Return type:

(BigDFT.Interop.DFTBInterop.DFTBLogfile)

_example()[source]

The following is an example of module usage:

"""Example of using DFTB+ interoperability"""
from BigDFT.IO import XYZReader
from BigDFT.Systems import System
from BigDFT.Fragments import Fragment
from os.path import join
from os import getcwd
from copy import deepcopy

# Create a system.
reader = XYZReader("H")
fsys = System()
fsys["FRA:1"] = Fragment(xyzfile=reader)
fsys["FRA:2"] = deepcopy(fsys["FRA:1"])
fsys["FRA:2"].translate([0.7414, 0, 0])

# Create an input file
# https://github.com/dftbplus/hsd-python
inp = {}
inp["Driver"] = {}
inp["Hamiltonian"] = {"DFTB": {"MaxAngularMomentum": {}, 
                               "SlaterKosterFiles": {"Type2FileNames": {}}}}

inp["Hamiltonian"]["DFTB"]["MaxAngularMomentum"] = {"H": "s"}
skf = {"Suffix": ".skf", "Separator": "-", 
       "Prefix": join(getcwd(), "input", "3ob-3-1/")}
inp["Hamiltonian"]["DFTB"]["SlaterKosterFiles"]["Type2FileNames"] = skf

# Create a Calculator and Run
calc = DFTBCalculator(mpi_run="mpirun -np 1")
log = calc.run(sys=fsys, input=inp, name="H2", run_dir="scratch")

# The full set of data from the `results.tag` file are available.
log["mermin_energy"]